<?php
/*
$zip = new ZipArchive;
$res = $zip->open('test.zip');
$zip->extractTo('/', 'foo.txt');

$myFile = "foo.txt";
$fh = fopen($myFile, 'r');

$theData = fread($fh, filesize($myFile));

fwrite($handle, "Test");
echo $theData;
echo "test";
*/

foreach(glob('*.zip') as $zipFile) {

	$zip = new ZipArchive;

	if ($zip->open($zipFile) === TRUE) {

		// get the filename without extension.
		$filename = pathinfo($zipFile,PATHINFO_FILENAME);

		// extract.
		$zip->extractTo($filename, 'elevator.txt');
		$zip->close();
		//echo "Extracted contents of $zipFile to $filename","\n";
		
	//	echo "Trying to read from ZipFile: \n";
		
		$myFile = "test/elevator.txt";
		//echo $myFile;
		$fh = fopen($myFile, 'r');
		$theData = fread($fh, filesize($myFile));
		echo $theData;
	} else {
	echo "Failed to open $zipFile","\n";
	}
	}


?>